package com.gnerv.author.controller;


import com.gnerv.author.entity.Config;
import com.gnerv.author.entity.R;
import com.gnerv.author.service.IConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 博客平台-配置表 前端控制器
 * </p>
 *
 * @author Gnerv LiGen
 * @since 2019-07-15
 */
@RestController
@RequestMapping("/blog/config")
public class ConfigController {

    @Autowired
    IConfigService configService;
    
    @RequestMapping(value = "update", method = RequestMethod.POST)
    public R update(String blogName, String blogLogo, String realmName){
        configService.updateConfig(blogName, blogLogo, realmName);
        return R.back();
    }
    
    @RequestMapping(value = "list", method = RequestMethod.POST)
    public R list(@RequestBody Config config){
        Map<String, Object> map = configService.listConfig(config);
        return R.back().data("configs", map);
    }
    
    
}
